import React,{createRef,useRef,useState} from 'react';
//当组件初次挂载的时候会执行此函数返回虚拟DOM
function TextInputWithFocusButton(){
  //在组件内定义了一个状态，默认是0
  let [count,setCount] = useState(0);
  //在渲染的时候直接调用setCount方法用来修改状态，改为老状态加1
  //改完之后组件会重新刷新
  setCount(count=>count+1); 
  return (
	<div>
		<p>{count}</p>
		<button onClick={()=>setCount(count=>count+1)}>+</button>
	</div>
  )
}
export default TextInputWithFocusButton;
